package main

import "fmt"

type Pipeline interface {
	Send(data string)
}

type MessagePipeline struct {
	msgQueue []string
}

func (p *MessagePipeline) Send(msg string) {
	p.msgQueue = append(p.msgQueue, msg)
}

type PipelineWithRecord interface {
	Pipeline
	Record(data string)
}

type MessagePipelineWithRecord struct {
	pipeline Pipeline
	records  []string
}

func (p *MessagePipelineWithRecord) Record(data string) {
	p.records = append(p.records, data)
	fmt.Printf("data '%s' is recorded\n", data)
}

func (p *MessagePipelineWithRecord) Send(data string) {
	p.Record(data)
	p.pipeline.Send(data)
}

func main() {
	pipeline := &MessagePipelineWithRecord{
		pipeline: &MessagePipeline{},
	}
	pipeline.Send("hello")
	pipeline.Send("world")
}
